﻿<dialogs:Dialog x:Class="Supremacy.Client.Dialogs.TargetSelectionDialog"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:scc="clr-namespace:Supremacy.Client"
                xmlns:dialogs="clr-namespace:Supremacy.Client.Dialogs">
  <StackPanel Orientation="Vertical">
    <ListBox x:Name="TargetsListBox"
             ItemsSource="{Binding Path=Targets, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dialogs:TargetSelectionDialog}}}"
             DisplayMemberPath="{Binding Path=TargetDisplayMember, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dialogs:TargetSelectionDialog}}}"
             SelectedItem="{Binding Path=SelectedTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dialogs:TargetSelectionDialog}}, Mode=TwoWay}"
             FontFamily="{DynamicResource LCARS_ParagraphFont}"
             FontSize="12pt"
             Foreground="{DynamicResource LCARS_BeigeTextBrush}"
             Background="Transparent"
             Height="128">
      <ListBox.ItemContainerStyle>
        <Style TargetType="{x:Type ListBoxItem}">
          <Setter Property="TextBlock.FontSize"
                  Value="12pt" />
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type ListBoxItem}">
                <Border x:Name="ItemBorder"
                        Padding="2">
                  <ContentPresenter />
                </Border>
                <ControlTemplate.Triggers>
                  <Trigger Property="IsSelected"
                           Value="True">
                    <Setter TargetName="ItemBorder"
                            Property="Background"
                            Value="{DynamicResource LCARS_GrayGradient_Top_Bottom}" />
                  </Trigger>
                </ControlTemplate.Triggers>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style>
      </ListBox.ItemContainerStyle>
    </ListBox>
    <StackPanel Orientation="Horizontal"
                HorizontalAlignment="Center"
                Margin="0,12,0,0">
      <Button Margin="3,0,3,0"
              IsDefault="True"
              Command="dialogs:TargetSelectionDialog.SelectTargetCommand"
              CommandParameter="{Binding ElementName=TargetsListBox, Path=SelectedItem}"
              Style="{DynamicResource {x:Static scc:ClientResources.MessageDialogButtonStyleKey}}">
        <AccessText Text="{scc:StringResource Key=MESSAGE_DIALOG_OK, Case=Upper}" />
      </Button>
      <Button Margin="3,0,3,0"
              IsCancel="True"
              Style="{DynamicResource {x:Static scc:ClientResources.MessageDialogButtonStyleKey}}">
        <AccessText Text="{scc:StringResource Key=MESSAGE_DIALOG_CANCEL, Case=Upper}" />
      </Button>
    </StackPanel>
  </StackPanel>
</dialogs:Dialog>
